﻿namespace _047_SimpleFactorySample;

// 简单工厂类
public class AnimalFactory
{
    public static IAnimal CreateAnimal(string animalType)
    {
        switch (animalType.ToLower())
        {
            case "dog":
                return new Dog();
                break;
            case "cat":
                return new Cat();
                break;
            default:
                throw new ArgumentException("Unknown animal type");
        }

        return null;
    }
}